# 1、对list进行切片👉从1开始，6结束，步长为1
my_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n']
slice1 = my_list[1:6:1]
slice2 = my_list[1:6]
print(F'{slice1}，{slice2}')
print(slice1 == slice2)
print('😀😀😀😀😀😀😀😀')

# 2、对tuple进行切片，从头开始，到最后结束，步长为1
my_tuple = ('666', '555', '888')
slice3 = my_tuple[0:3:1]
slice4 = my_tuple[::]
slice5 = my_tuple[:]
print(slice3)
print(slice3 == slice4 == slice5)  # True
print('😀😀😀😀😀😀😀😀')

# 3、对str进行切片，从头开始，到最后结束，步长为2
my_str = 'JagochanSuccess'
slice6 = my_str[::2]
print(slice6)
print('😀😀😀😀😀😀😀😀')

# 4、对str进行切片，从头开始，到最后结束，步长为-1
my_str = 'JagochanSuccess'
slice7 = my_str[::-1]  # 等同于把序列反转了
print(slice7)
print('😀😀😀😀😀😀😀😀')

# 5、对list进行切片，从3开始，到1结束，步长-1
my_list = ['a', 'b', 'c', 'd', 'e', 'f']
slice8 = my_list[3:1:-1]
print(slice8)

# 6、对元组进行切片，从头开始，到尾结束，步长-2
my_tuple = ('666', '555', '888', '111', '222', '999')
slice9 = my_tuple[::-2]
print(slice9)
